<?php
/* @var $this SiteController */

if (Yii::app()->session["user_id"] == null) {
    $this->redirect(array("site/index"));
}
$this->pageTitle = Yii::app()->name;
?>
<?php if (Yii::app()->session["user_status"] == "Administrator"): ?>
<div>
    <a href="<?php echo Yii::app()->createUrl("Questions/Form"); ?>">
        <div><?php echo CHtml::image("images/add.png"); ?></div>

    </a>
</div>
<?php endif ?>

<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider' => $ques->search(),
    'columns' => array(
        //'ques_id',
        array(
            'header' => 'ลำดับที่',
            'type' => 'html',
            //'value' => 'CHtml::link($data->id_member, array("Config/EmployeeView", "id" => $data->id_member))',
            //'value' => '$data->ques_id',
            'value' => array($ques, "number"),
            'htmlOptions' => array(
                'width' => '100px',
                'align' => 'center'
            )
        ),
        'ques_name',
        'ques_created',
        
        array(
            'header' => '',
            'type' => 'html',
            //'class' => 'CLinkColumn',
            //'imageUrl' => 'images/like.png',
            'value' => array($ques, "getButtonEdit"),
            //'urlExpression' => 'Yii::app()->createUrl("Answers/Answers", array("id" => $data->ques_id))',
            'htmlOptions' => array(
                'width' => '35px',
                'align' => 'center'
            )
        ),
        
        array(
            'header' => '',
            //'type' => 'html',
            'class' => 'CLinkColumn',
            'imageUrl' => 'images/comment.png',
            //'value' => array($ques, "getPoll"),
            'urlExpression' => 'Yii::app()->createUrl("Answers/ViewComment", array("id" => $data->ques_id))',
            'htmlOptions' => array(
                'width' => '35px',
                'align' => 'center'
            )
        ),
        
        array(
            'header' => '',
            //'type' => 'html',
            'class' => 'CLinkColumn',
            'imageUrl' => 'images/chart.png',
            //'value' => array($ques, "getPoll"),
            'urlExpression' => 'Yii::app()->createUrl("Report/ReportDetail", array("id" => $data->ques_id))',
            'htmlOptions' => array(
                'width' => '35px',
                'align' => 'center'
            )
        )
    )
));
?>